<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Return info about system resource limits</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.posix-getpwuid.html">« posix_getpwuid</a></li>
      <li style="float: right;"><a href="function.posix-getsid.html">posix_getsid »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.posix.html">POSIX 函数</a></li>
    <li>Return info about system resource limits</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.posix-getrlimit" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">posix_getrlimit</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">posix_getrlimit</span> &mdash; <span class="dc-title">Return info about system resource limits</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.posix-getrlimit-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>posix_getrlimit</strong></span>(): <span class="type"><span class="type">array</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>posix_getrlimit()</strong></span> returns an <span class="type">array</span>
   of information about the current resource&#039;s soft and hard limits.
  </p>
  
<p class="para">
  Each resource has an associated soft and hard limit.  The soft
  limit is the value that the kernel enforces for the corresponding
  resource.  The hard limit acts as a ceiling for the soft limit.
  An unprivileged process may only set its soft limit to a value
  from 0 to the hard limit, and irreversibly lower its hard limit.
</p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.posix-getrlimit-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.posix-getrlimit-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an associative <span class="type">array</span> of elements for each
   limit that is defined. Each limit has a soft and a hard limit.
   <table class="doctable table">
    <caption><strong>List of possible limits returned</strong></caption>
    
     <thead>
      <tr>
       <th>Limit name</th>
       <th>Limit description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>core</td>
       <td>
        The maximum size of the core file.  When 0, not core files are
        created.  When core files are larger than this size, they will
        be truncated at this size.
       </td>
      </tr>

      <tr>
       <td>totalmem</td>
       <td>
        The maximum size of the memory of the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>virtualmem</td>
       <td>
        The maximum size of the virtual memory for the process, in bytes.
       </td>
      </tr>
 
      <tr>
       <td>data</td>
       <td>
        The maximum size of the data segment for the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>stack</td>
       <td>
        The maximum size of the process stack, in bytes.
       </td>
      </tr>

      <tr>
       <td>rss</td>
       <td>
        The maximum number of virtual pages resident in RAM
       </td>
      </tr>

      <tr>
       <td>maxproc</td>
       <td>
        The maximum number of processes that can be created for the
        real user ID of the calling process.
       </td>
      </tr>

      <tr>
       <td>memlock</td>
       <td>
        The maximum number of bytes of memory that may be locked into RAM.
       </td>
      </tr>

      <tr>
       <td>cpu</td>
       <td>
        The amount of time the process is allowed to use the CPU.
       </td>
      </tr>

      <tr>
       <td>filesize</td>
       <td>
        The maximum size of the data segment for the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>openfiles</td>
       <td>
        One more than the maximum number of open file descriptors.
       </td>
      </tr>

     </tbody>
    
   </table>

   The function returns <strong><code>false</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.posix-getrlimit-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3296">
    <p><strong>示例 #1 Example use of <span class="function"><strong>posix_getrlimit()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$limits&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">posix_getrlimit</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$limits</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [soft core] =&gt; 0
    [hard core] =&gt; unlimited
    [soft data] =&gt; unlimited
    [hard data] =&gt; unlimited
    [soft stack] =&gt; 8388608
    [hard stack] =&gt; unlimited
    [soft totalmem] =&gt; unlimited
    [hard totalmem] =&gt; unlimited
    [soft rss] =&gt; unlimited
    [hard rss] =&gt; unlimited
    [soft maxproc] =&gt; unlimited
    [hard maxproc] =&gt; unlimited
    [soft memlock] =&gt; unlimited
    [hard memlock] =&gt; unlimited
    [soft cpu] =&gt; unlimited
    [hard cpu] =&gt; unlimited
    [soft filesize] =&gt; unlimited
    [hard filesize] =&gt; unlimited
    [soft openfiles] =&gt; 1024
    [hard openfiles] =&gt; 1024
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.posix-getrlimit-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member">man page GETRLIMIT(2)</li>
    <li class="member"><span class="function"><a href="function.posix-setrlimit.html" class="function" rel="rdfs-seeAlso">posix_setrlimit()</a> - Set system resource limits</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>